package com.banmao.c03_baseUsage;

import com.banmao.c03_baseUsage.config.BeanConfig;
import com.banmao.c03_baseUsage.entity.Dog;
import com.banmao.c03_baseUsage.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@Slf4j
public class Demo04 {

    public static void main(String[] args) {
        /*
            AnnotationConfigApplicationContext：注解注入
         */
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(BeanConfig.class);

        Dog dog = ctx.getBean("dog", Dog.class);
        log.info("dog: {}", dog);

        User user = ctx.getBean("user", User.class);
        log.info("user: {}", user);

    }

}
